import matplotlib.pyplot as plt


def fitness_line(x, y1, y2, y3):

    # 双y轴
    fig, ax1 = plt.subplots()
    ax1.plot(x, y1, '-', alpha=0.5, markersize=2, linewidth=2, color='#2c7fb8',
             label='satisfaction')  # 'rs-'表示红色方块
    ## plot中参数的含义分别是横轴值，纵轴值，线的形状（'s'方块,'o'实心圆点，'*'五角星   ...，颜色，透明度,线的宽度和标签 ，

    ax1.set_ylabel('satisfaction', color='#2c7fb8')
    ax2 = ax1.twinx()
    ax2.plot(x, y2, '-', alpha=0.5, markersize=2, linewidth=2, color='#dd1c77', label='utilization')
    ax2.set_ylabel('utilization', color='#dd1c77')
    ax3 = ax1.twinx()
    ax3.plot(x, y3, '-', alpha=0.5, markersize=2, linewidth=2, color='#00CCBF', label='distance')
    ax3.set_ylabel('distance', color='#00CCBF')

    # plt.plot(x_fit, y1_fit, '-', alpha=0.5, markersize=2, linewidth=2, color='#2c7fb8',  label='satisfaction')  # 'rs-'表示红色方块
    # ## plot中参数的含义分别是横轴值，纵轴值，线的形状（'s'方块,'o'实心圆点，'*'五角星   ...，颜色，透明度,线的宽度和标签 ，
    # plt.plot(x_fit, y2_fit, '-', alpha=0.5, markersize=2, linewidth=2, color='#dd1c77', label='utilization')

    fig.tight_layout()
    # plt.legend()  # 显示上面的label
    plt.xlabel('t')  # x_label
    # plt.ylabel('fintness')  # y_label

    plt.show()
